package com.gopay.common.cps.dao.ic.impl;

import com.gopay.common.base.dao.impl.BaseDAOImpl;
import com.gopay.common.cps.dao.ic.ReportDailyDAO;
import com.gopay.common.domain.ic.ReportDaily;
import org.springframework.stereotype.Repository;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @Description 内部对账日报Dao实现
 * @Author jianghoupeng
 * @Date 2016/12/27 11:02
 * <p/>
 * Copyright (c) 2016. www.gopay.com.cn Inc.All rights reserved.
 */
@Repository("reportDailyDAO")
public class ReportDailyDAOImpl extends BaseDAOImpl<ReportDaily, String> implements ReportDailyDAO {

    @Override
    public ReportDaily queryRDBycheckDate(ReportDaily reportDaily) {
        StringBuilder hql = new StringBuilder();
        Map param = new HashMap<>();
        param.put("checkDate", reportDaily.getCheckDate());
        hql.append(" from ReportDaily where checkDate =:checkDate");
        List<ReportDaily> list = this.findByHql(hql.toString(), param);
        if (list != null && list.size() == 1){
            return list.get(0);
        }
        return null;
    }
}
